;(function($){
	var TabOption=function(tab){
		var self=this;
		
		this.tabTitleItems=$(".tit").find("li"); //获取标题个数
		this.tabConItems=$(".js-tab-con");  //获取选项卡个数
		
		this.setIndex(); //设置标题和选项卡的索引
		
		this.tabTitleItems.each(function(){
			this.onmouseover=function(){
				var curIndex=$(this).attr("id");
				self.sethighlight(curIndex);
				self.setConDisplay(curIndex);
			};
		});
	};
	
	TabOption.prototype={
		
		//设置标题和选项卡的序列号
		setIndex:function(){
		    this.tabTitleItems.each(function(i){
		    	this.id=i;
		    });
		    
		    this.tabConItems.each(function(i){
		    	this.id=i;
		    });
		},
		
		//设置标题的高亮效果
		sethighlight:function(cur){
			
			this.tabTitleItems.each(function(){
				$(this).css({
					"background-color":"#e8e8e8",
					"border-left":"0px",
					"border-right":"0px",
					"border-bottom":"1px solid black",
					"box-shadow":"1px 1px 1px rgba(0,0,0,1)"
				});
			});
			
			this.tabTitleItems.each(function(){
				var index=$(this).attr("id");
				if(index===cur){
					$(this).css({
						"background-color":"white",
						"box-shadow":"0px 0px 0px",
						"border-left":"1px solid #CDAD00",
						"border-right":"1px solid #CDAD00",
						"border-bottom":"0px"
					});
				}
			});
		},
		
		//设置选项卡display为block
		setConDisplay:function(cur){
			this.tabConItems.each(function(){
				$(this).css({
					"display":"none"
				});
			});
			
			this.tabConItems.each(function(){
				var curN0=$(this).attr("id");
				if(curN0===cur){
					$(this).css({
						"display":"block"
					});
				}
			});
		}
		
	};
	
	TabOption.init=function(tabs){
		var _this_=this;
		tabs.each(function(){
			new _this_($(this));
		});
	};
	
	window["TabOption"]=TabOption;
})(jQuery);

